import React, { PureComponent } from 'react'
import PropTypes from 'prop-types'
import Cover from '@/components/Cover'
import { formatNumber, formatTime } from '@/utils'
import css from './postVideo.module.scss'
export default class SpacePostVideo extends PureComponent {
    static propTypes = {
        aid: PropTypes.oneOfType([
            PropTypes.string,
            PropTypes.number
        ]),
        bvid: PropTypes.oneOfType([
            PropTypes.string,
            PropTypes.number
        ]),
        pic: PropTypes.string,
        title: PropTypes.string,
        view: PropTypes.number,
        danmaku: PropTypes.number,
        duration: PropTypes.oneOfType([
            PropTypes.string,
            PropTypes.number
        ]),
        onClick: PropTypes.func
    }

    render() {
        const { view, danmaku, duration } = this.props
        return (
            <div className={css["wrap"]}>
                <Cover {...this.props} play={view}>
                    <div className={css['count']}>
                        <span className="duration">{formatTime(duration)}</span>
                        <span>{formatNumber(view)}观看</span>
                        <span>{formatNumber(danmaku)}弹幕</span>
                    </div>
                </Cover>
            </div>
        )
    }
}
